# sparecap2L.mod
# change from sparecap3k.mod  
# by Yu Liu, 01/22/2006.
# Arc-flow model for spare capacity allocaiton for two layer networks
# target for solve model for two layer SCA

# for Model 3 on multilayer networks
# model sparecap.mod;

# include model for bottom layer working
#model workcap_bottom.mod;
#include preworkb.sa
#solve find_work_b;

# include model for bottom layer
#model sparecap_bottom.mod 

s.t. spm_comp_b2l {(j1,j2) in EDGES, k in FAILS}:
  Gb[j1,j2,k] = (sum{(r1,r2) in FLOWSL} 
    ( ML[r1,r2] * (Qb[r1,r2,j1,j2] * UL[r1,r2,k]) ))
	+ (sum{(i1,i2) in LINKS} (H[i1,i2,j1,j2] * sum{(r1,r2) in FLOWS} 
     (M[r1,r2] * (Q[r1,r2,i1,i2] * U[r1,r2,k]) ) ) );
# Gb = Q^T M U + H ^T (Qb^T Mb Ub)

problem find_spare4: 
sl_cost, cap_aggrS_b, spm_comp_b2l, 
fail_disj, mass_baS, backup_sym, 
fail_disj_b, mass_baS_b, backup_sym_b, 
Q, Qb, Gb, sl;

